var __extends =
    (this && this.__extends) ||
    (function () {
      var e = function (t, n) {
        return (e =
          Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array &&
            function (e, t) {
              e.__proto__ = t;
            }) ||
          function (e, t) {
            for (var n in t)
              Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
          })(t, n);
      };
      return function (t, n) {
        function a() {
          this.constructor = t;
        }
        if ("function" != typeof n && null !== n)
          throw new TypeError(
            "Class extends value " + String(n) + " is not a constructor or null"
          );
        e(t, n),
          (t.prototype =
            null === n
              ? Object.create(n)
              : ((a.prototype = n.prototype), new a()));
      };
    })(),
  UseHunDanDialog = (function (e) {
    function t() {
      var t = e.call(this) || this;
      return (
        (t.list_hundan_use.selectEnable = !0),
        (t.list_hundan_use.vScrollBarSkin = ""),
        t.list_hundan_use.on(Laya.Event.CLICK, t, t.onSupplyPhysicalDidClickFn),
        WebSocketService.addListener({
          caller: t,
          code: 6407,
          method: t.onLoadUseHunYuanDanData,
        }),
        WebSocketService.addListener({
          caller: t,
          code: 6408,
          method: t.onLoadSureUseHunDanFn,
        }),
        WebSocketService.addListener({
          caller: t,
          code: 1425,
          method: t.onLoadZanWuData,
        }),
        t
      );
    }
    return (
      __extends(t, e),
      (t.showUseHunView = function (e) {
        null == this.useHunDanV &&
          ((this.useHunDanV = new t()), (this.useHunDanV.zOrder = 1e3)),
          this.useHunDanV.popup(!0),
          (this.useHunDanV.objRes = e),
          (this.useHunDanV.label_hundan_main_title.text =
            "魂元丹" + e.num + "个"),
          WebSocketService.send({ c: 6407, d: { pageNum: 0 } });
      }),
      (t.prototype.onSupplyPhysicalDidClickFn = function (e) {
        if ("" != e.target.name && "btn_hundan_shiyong" == e.target.name) {
          var t = this.objRes.id,
            n = this.list_hundan_use.selectedItem.id;
          WebSocketService.send({ c: 6408, d: { gid: t, sid: n } });
        }
      }),
      (t.prototype.onLoadUseHunYuanDanData = function (e) {
        if (0 == e.code) {
          this.dataArr = e.list;
          var t = void 0;
          this.dataSource = [];
          for (var n = 0; n < this.dataArr.length; n++)
            (t = {
              lable_hundan_name: {
                text: this.dataArr[n].lvl + "级" + this.dataArr[n].name,
              },
              lable_hundan_desc: { text: this.dataArr[n].desc },
              id: this.dataArr[n].id,
            }),
              this.dataSource.push(t);
          this.list_hundan_use.dataSource = this.dataSource;
        }
      }),
      (t.prototype.onLoadSureUseHunDanFn = function (e) {
        0 == e.code && WebSocketService.send({ c: 1425, d: { pageNum: 0 } }),
          ToastView.toastView(e.msg);
      }),
      (t.prototype.onLoadZanWuData = function (e) {
        if (0 == e.code)
          for (var t = 0; t < e.data.length; t++) {
            var n = e.data[t];
            "421" == n.id &&
              (this.label_hundan_main_title.text = "魂元丹" + n.num + "个");
          }
      }),
      t
    );
  })(ui.TabBarItemController.UseHunDanDialogUI);
